package com.ydl.shopping.core.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ydl.shopping.core.valid.ValidGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.Date;

@Data
public class BaseEntity {
    /** 搜索关键词 */
    @TableField(exist = false)
    @Schema(description = "搜索关键词")
    private String searchKeyword;

    /** 页码 */
    @TableField(exist = false)
    @Schema(description = "页码")
    private Long pageNumber;
    /** 页数 */
    @TableField(exist = false)
    @Schema(description = "页数")
    private Long pageSize;

    /** 主键 */
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableId("id")
    @NotNull(groups = ValidGroup.Crud.Update.class)
    @Schema(description = "主键")
    private Long id;

    /** 创建人 */
    @TableField("create_by")
    @Schema(description = "创建人")
    private String createBy;
    /** 创建时间 */
    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "创建时间")
    private Date createTime;
    /** 更新人 */
    @TableField("update_by")
    @Schema(description = "更新人")
    private String updateBy;
    /** 更新时间 */
    @TableField("update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "更新时间")
    private Date updateTime;
    /** 备注 */
    @TableField("remark")
    @Schema(description = "备注")
    private String remark;
}
